package showgo.gui;

import java.util.List;

import javax.swing.JTable;

import showgo.modell.stamm.Person;

public class PersonTable extends JTable {

    /**
     * 
     */
    private static final long serialVersionUID = 1770259191431621131L;

    public PersonTable() {
	setModel(new PersonTableModel());
    }

    public void addPerson(Person person) {
	((PersonTableModel) getModel()).addPerson(person);
    }

    public List<Person> getPersonen() {
	return ((PersonTableModel) getModel()).getPersonen();
    }

    public void replacePerson(Person oldPerson, Person newPerson) {
	((PersonTableModel) getModel()).replacePerson(oldPerson, newPerson);
    }

    public Person getPersonAt(int rowIndex) {
	return ((PersonTableModel) getModel()).getPersonAt(rowIndex);
    }

    public void refresh() {
	((PersonTableModel) getModel()).fireTableDataChanged();
    }

    public boolean isEmpty() {
	return ((PersonTableModel) getModel()).isEmpty();
    }

    public void removePerson(Person person) {
	((PersonTableModel) getModel()).removePerson(person);
    }

    public Person removePersonAt(int rowIndex) {
	return ((PersonTableModel) getModel()).removePersonAt(rowIndex);
    }

}
